# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.InstanceGroupManager do
  @moduledoc """
  Represents a Managed Instance Group resource. An instance group is a collection of VM instances that you can manage as a single entity. For more information, read Instance groups. For zonal Managed Instance Group, use the instanceGroupManagers resource. For regional Managed Instance Group, use the regionInstanceGroupManagers resource.

  ## Attributes

  *   `allInstancesConfig` (*type:* `GoogleApi.Compute.V1.Model.InstanceGroupManagerAllInstancesConfig.t`, *default:* `nil`) - Specifies configuration that overrides the instance template configuration for the group.
  *   `autoHealingPolicies` (*type:* `list(GoogleApi.Compute.V1.Model.InstanceGroupManagerAutoHealingPolicy.t)`, *default:* `nil`) - The autohealing policy for this managed instance group. You can specify only one value.
  *   `baseInstanceName` (*type:* `String.t`, *default:* `nil`) - The base instance name is a prefix that you want to attach to the names of all VMs in a MIG. The maximum character length is 58 and the name must comply with RFC1035 format. When a VM is created in the group, the MIG appends a hyphen and a random four-character string to the base instance name. If you want the MIG to assign sequential numbers instead of a random string, then end the base instance name with a hyphen followed by one or more hash symbols. The hash symbols indicate the number of digits. For example, a base instance name of "vm-###" results in "vm-001" as a VM name. @pattern [a-z](([-a-z0-9]{0,57})|([-a-z0-9]{0,51}-\#{1,10}(\\\\[[0-9]{1,10}\\\\])?))
  *   `creationTimestamp` (*type:* `String.t`, *default:* `nil`) - [Output Only] The creation timestamp for this managed instance group in RFC3339 text format.
  *   `currentActions` (*type:* `GoogleApi.Compute.V1.Model.InstanceGroupManagerActionsSummary.t`, *default:* `nil`) - [Output Only] The list of instance actions and the number of instances in this managed instance group that are scheduled for each of those actions.
  *   `description` (*type:* `String.t`, *default:* `nil`) - An optional description of this resource.
  *   `distributionPolicy` (*type:* `GoogleApi.Compute.V1.Model.DistributionPolicy.t`, *default:* `nil`) - Policy specifying the intended distribution of managed instances across zones in a regional managed instance group.
  *   `fingerprint` (*type:* `String.t`, *default:* `nil`) - Fingerprint of this resource. This field may be used in optimistic locking. It will be ignored when inserting an InstanceGroupManager. An up-to-date fingerprint must be provided in order to update the InstanceGroupManager, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an InstanceGroupManager.
  *   `id` (*type:* `String.t`, *default:* `nil`) - [Output Only] A unique identifier for this resource type. The server generates this identifier.
  *   `instanceFlexibilityPolicy` (*type:* `GoogleApi.Compute.V1.Model.InstanceGroupManagerInstanceFlexibilityPolicy.t`, *default:* `nil`) - Instance flexibility allowing MIG to create VMs from multiple types of machines. Instance flexibility configuration on MIG overrides instance template configuration.
  *   `instanceGroup` (*type:* `String.t`, *default:* `nil`) - [Output Only] The URL of the Instance Group resource.
  *   `instanceLifecyclePolicy` (*type:* `GoogleApi.Compute.V1.Model.InstanceGroupManagerInstanceLifecyclePolicy.t`, *default:* `nil`) - The repair policy for this managed instance group.
  *   `instanceTemplate` (*type:* `String.t`, *default:* `nil`) - The URL of the instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE.
  *   `kind` (*type:* `String.t`, *default:* `compute#instanceGroupManager`) - [Output Only] The resource type, which is always compute#instanceGroupManager for managed instance groups.
  *   `listManagedInstancesResults` (*type:* `String.t`, *default:* `nil`) - Pagination behavior of the listManagedInstances API method for this managed instance group.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035.
  *   `namedPorts` (*type:* `list(GoogleApi.Compute.V1.Model.NamedPort.t)`, *default:* `nil`) - [Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager.
  *   `region` (*type:* `String.t`, *default:* `nil`) - [Output Only] The URL of the region where the managed instance group resides (for regional resources).
  *   `resourcePolicies` (*type:* `GoogleApi.Compute.V1.Model.InstanceGroupManagerResourcePolicies.t`, *default:* `nil`) - Resource policies for this managed instance group.
  *   `satisfiesPzi` (*type:* `boolean()`, *default:* `nil`) - [Output Only] Reserved for future use.
  *   `satisfiesPzs` (*type:* `boolean()`, *default:* `nil`) - [Output Only] Reserved for future use.
  *   `selfLink` (*type:* `String.t`, *default:* `nil`) - [Output Only] The URL for this managed instance group. The server defines this URL.
  *   `standbyPolicy` (*type:* `GoogleApi.Compute.V1.Model.InstanceGroupManagerStandbyPolicy.t`, *default:* `nil`) - Standby policy for stopped and suspended instances.
  *   `statefulPolicy` (*type:* `GoogleApi.Compute.V1.Model.StatefulPolicy.t`, *default:* `nil`) - Stateful configuration for this Instanced Group Manager
  *   `status` (*type:* `GoogleApi.Compute.V1.Model.InstanceGroupManagerStatus.t`, *default:* `nil`) - [Output Only] The status of this managed instance group.
  *   `targetPools` (*type:* `list(String.t)`, *default:* `nil`) - The URLs for all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group.
  *   `targetSize` (*type:* `integer()`, *default:* `nil`) - The target number of running instances for this managed instance group. You can reduce this number by using the instanceGroupManager deleteInstances or abandonInstances methods. Resizing the group also changes this number.
  *   `targetStoppedSize` (*type:* `integer()`, *default:* `nil`) - The target number of stopped instances for this managed instance group. This number changes when you: - Stop instance using the stopInstances method or start instances using the startInstances method. - Manually change the targetStoppedSize using the update method. 
  *   `targetSuspendedSize` (*type:* `integer()`, *default:* `nil`) - The target number of suspended instances for this managed instance group. This number changes when you: - Suspend instance using the suspendInstances method or resume instances using the resumeInstances method. - Manually change the targetSuspendedSize using the update method. 
  *   `updatePolicy` (*type:* `GoogleApi.Compute.V1.Model.InstanceGroupManagerUpdatePolicy.t`, *default:* `nil`) - The update policy for this managed instance group.
  *   `versions` (*type:* `list(GoogleApi.Compute.V1.Model.InstanceGroupManagerVersion.t)`, *default:* `nil`) - Specifies the instance templates used by this managed instance group to create instances. Each version is defined by an instanceTemplate and a name. Every version can appear at most once per instance group. This field overrides the top-level instanceTemplate field. Read more about the relationships between these fields. Exactly one version must leave the targetSize field unset. That version will be applied to all remaining instances. For more information, read about canary updates.
  *   `zone` (*type:* `String.t`, *default:* `nil`) - [Output Only] The URL of a zone where the managed instance group is located (for zonal resources).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allInstancesConfig =>
            GoogleApi.Compute.V1.Model.InstanceGroupManagerAllInstancesConfig.t() | nil,
          :autoHealingPolicies =>
            list(GoogleApi.Compute.V1.Model.InstanceGroupManagerAutoHealingPolicy.t()) | nil,
          :baseInstanceName => String.t() | nil,
          :creationTimestamp => String.t() | nil,
          :currentActions =>
            GoogleApi.Compute.V1.Model.InstanceGroupManagerActionsSummary.t() | nil,
          :description => String.t() | nil,
          :distributionPolicy => GoogleApi.Compute.V1.Model.DistributionPolicy.t() | nil,
          :fingerprint => String.t() | nil,
          :id => String.t() | nil,
          :instanceFlexibilityPolicy =>
            GoogleApi.Compute.V1.Model.InstanceGroupManagerInstanceFlexibilityPolicy.t() | nil,
          :instanceGroup => String.t() | nil,
          :instanceLifecyclePolicy =>
            GoogleApi.Compute.V1.Model.InstanceGroupManagerInstanceLifecyclePolicy.t() | nil,
          :instanceTemplate => String.t() | nil,
          :kind => String.t() | nil,
          :listManagedInstancesResults => String.t() | nil,
          :name => String.t() | nil,
          :namedPorts => list(GoogleApi.Compute.V1.Model.NamedPort.t()) | nil,
          :region => String.t() | nil,
          :resourcePolicies =>
            GoogleApi.Compute.V1.Model.InstanceGroupManagerResourcePolicies.t() | nil,
          :satisfiesPzi => boolean() | nil,
          :satisfiesPzs => boolean() | nil,
          :selfLink => String.t() | nil,
          :standbyPolicy =>
            GoogleApi.Compute.V1.Model.InstanceGroupManagerStandbyPolicy.t() | nil,
          :statefulPolicy => GoogleApi.Compute.V1.Model.StatefulPolicy.t() | nil,
          :status => GoogleApi.Compute.V1.Model.InstanceGroupManagerStatus.t() | nil,
          :targetPools => list(String.t()) | nil,
          :targetSize => integer() | nil,
          :targetStoppedSize => integer() | nil,
          :targetSuspendedSize => integer() | nil,
          :updatePolicy => GoogleApi.Compute.V1.Model.InstanceGroupManagerUpdatePolicy.t() | nil,
          :versions => list(GoogleApi.Compute.V1.Model.InstanceGroupManagerVersion.t()) | nil,
          :zone => String.t() | nil
        }

  field(:allInstancesConfig, as: GoogleApi.Compute.V1.Model.InstanceGroupManagerAllInstancesConfig)

  field(:autoHealingPolicies,
    as: GoogleApi.Compute.V1.Model.InstanceGroupManagerAutoHealingPolicy,
    type: :list
  )

  field(:baseInstanceName)
  field(:creationTimestamp)
  field(:currentActions, as: GoogleApi.Compute.V1.Model.InstanceGroupManagerActionsSummary)
  field(:description)
  field(:distributionPolicy, as: GoogleApi.Compute.V1.Model.DistributionPolicy)
  field(:fingerprint)
  field(:id)

  field(:instanceFlexibilityPolicy,
    as: GoogleApi.Compute.V1.Model.InstanceGroupManagerInstanceFlexibilityPolicy
  )

  field(:instanceGroup)

  field(:instanceLifecyclePolicy,
    as: GoogleApi.Compute.V1.Model.InstanceGroupManagerInstanceLifecyclePolicy
  )

  field(:instanceTemplate)
  field(:kind)
  field(:listManagedInstancesResults)
  field(:name)
  field(:namedPorts, as: GoogleApi.Compute.V1.Model.NamedPort, type: :list)
  field(:region)
  field(:resourcePolicies, as: GoogleApi.Compute.V1.Model.InstanceGroupManagerResourcePolicies)
  field(:satisfiesPzi)
  field(:satisfiesPzs)
  field(:selfLink)
  field(:standbyPolicy, as: GoogleApi.Compute.V1.Model.InstanceGroupManagerStandbyPolicy)
  field(:statefulPolicy, as: GoogleApi.Compute.V1.Model.StatefulPolicy)
  field(:status, as: GoogleApi.Compute.V1.Model.InstanceGroupManagerStatus)
  field(:targetPools, type: :list)
  field(:targetSize)
  field(:targetStoppedSize)
  field(:targetSuspendedSize)
  field(:updatePolicy, as: GoogleApi.Compute.V1.Model.InstanceGroupManagerUpdatePolicy)
  field(:versions, as: GoogleApi.Compute.V1.Model.InstanceGroupManagerVersion, type: :list)
  field(:zone)
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.InstanceGroupManager do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.InstanceGroupManager.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.InstanceGroupManager do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
